package com.millstein.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.jsonwebtoken.Claims;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description:
 * @author: tsing
 * @create: 2021-09-13 15:28
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoginUser {
    @ApiModelProperty("主键")
    private Long id;

    @ApiModelProperty("昵称")
    private String name;

    @ApiModelProperty("头像")
    @JsonProperty("head_img")
    private String headImg;

    @ApiModelProperty("邮箱")
    private String mail;

    public LoginUser(Claims claims) {
        this.id = Long.parseLong(claims.get("id").toString());
        this.headImg = (String) claims.get("head_img");
        this.name = (String) claims.get("name");
        this.mail = (String) claims.get("mail");
    }
}
